function Corridor(color){
    this.color=color?color:colorList[getRamdom(0,colorList.length-1)]

    this.squList=[];
    this.canvas=document.createElement('canvas');

    // this.render();
}

Corridor.prototype={
    setList:function(){

    },
    render:function(){
        // this.setList();

        this.canvas.width=MAX_X*10+10;
        this.canvas.height=MAX_Y*10+10;

        var ctx=this.canvas.getContext('2d');
        ctx.fillStyle=this.color;
        for(var i=0;i<this.squList.length;i++){
            var temp=this.squList[i];
            temp.color=temp.No1?'red':this.color;

            temp.render();
            ctx.drawImage(temp.canvas,temp.realX,temp.realY)
        }

    }
}


function createCor(color){
    var color=color?color:colorList[getRamdom(0,colorList.length-1)];

    var tempCor=new Corridor(color);
    
    var tx=getRamdom(0,emptyList.length-1);
    var ty=getRamdom(0,emptyList[tx].length-1);
    var sSqu=emptyList[tx][ty];

    sSqu.No1=true;
    sSqu.color='red';

    console.log(sSqu);
    
    addToList(sSqu,tempCor.squList);

    tempCor.render();

    return tempCor

}

function buildBridge(){
    
}